#ifndef __VLOG_LOGEVENTWARP_H__
#define __VLOG_LOGEVENTWARP_H__

#include "logevent.h"
#include "logger.h"

namespace vlog
{

// 日志事件的包装器
class LogEventWarp
{
    public:
    LogEventWarp() = delete;

    ~LogEventWarp();

    LogEventWarp(Logger::ptr logger, event::LogEvent::ptr plogEvent);

    event::LogEvent::ptr GetLogEvent() const noexcept
    {
        return m_pLogEvent;
    }

    std::stringstream& GetMessageSS() const
    {
        if (m_pLogEvent)
        {
            return m_pLogEvent->GetEventMessageSS();
        }
        else
        {
            throw std::runtime_error("Log event not available"); // 抛出异常
        }
    }

    private:
    Logger::ptr m_logger;
    std::shared_ptr<event::LogEvent> m_pLogEvent;
};

} // namespace vlog

#endif